package com.xiaochong.tir.manager.service;

import org.springframework.stereotype.Service;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.xiaochong.tir.common.data.po.SyResearchReportFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaochong.tir.common.data.mapper.SyResearchReportFileMapper;
import org.springframework.transaction.annotation.Transactional;

/**
 * 此类为[基础代码]自动生成,已经拥有基本的增删改成操作 
 * <其他请自行扩展>
 * @author cx
 * @time 2018-04-28 10:45
 * 
 */
@Service
public class SyResearchReportFileService{
 
      
    @Autowired
	private SyResearchReportFileMapper syResearchReportFileDao;
	
	
	/**
     * 新增
     * @param entity 
     * @param session
     */
	@Transactional
    public int insertSelective (SyResearchReportFile entity) { 
     return this.syResearchReportFileDao.insertSelective(entity);
    }

    /**
     * 批量新增
     * @param list 
     * @param session
     */
    public void insertBatch(List<SyResearchReportFile> list) {
           
          this.syResearchReportFileDao.insertBatch(list);
         
         
    }
    
    /**
     * 根据主键修改单条数据
     * @param entity 
     * @param session
     */
    public int updateByPrimaryKey(SyResearchReportFile entity) {
           return this.syResearchReportFileDao.updateByPrimaryKey(entity);
    }
    
    /**
     * 根据主键批量修改数据
     * @param list 
     * @param session
     */
    public void updateBatch(List<SyResearchReportFile> list) {
           
          this.syResearchReportFileDao.updateBatch(list);
          
        
    }
    
    /**
     * 根据主键查询单条数据
     * @param id
     */
    public SyResearchReportFile selectByPrimaryKey(Integer id) {
            return this.syResearchReportFileDao.selectByPrimaryKey(id);
    }
    
    /**
     * 根据条件查询单条记录
     * @param entity 
     */
    public SyResearchReportFile selectByEntity(SyResearchReportFile entity) {
           return this.syResearchReportFileDao.selectByEntity(entity);
    }
    
    
    /**
     * 根据条件查询多条记录
     * @param entity 
     */
    public List<SyResearchReportFile> selectByEntityList(SyResearchReportFile entity) {
           return  this.syResearchReportFileDao.selectByEntityList(entity);
    }
    
    /**
     * 根据条件查询Id
     * @param entity 
     */
    public Integer selectById(SyResearchReportFile entity) {
           return  this.syResearchReportFileDao.selectById(entity);
    }
    
     /**
     * 根据条件查询Ids
     * @param entity 
     */
    public List<Integer> selectByIds(SyResearchReportFile entity) {
        return  this.syResearchReportFileDao.selectByIds(entity);
    }
    
     /**
     * 根据主键删除单条记录
     * @param id
     */
    public void deleteByPrimaryKey(Integer id) {
           this.syResearchReportFileDao.deleteByPrimaryKey(id);
    }
    
    /**
     * 根据主键删除多条记录
     * @param list
     */
    public void deleteBatch(List<Integer> list) {
           this.syResearchReportFileDao.deleteBatch(list);
    }
    
     /**
     * 根据某些条件删除
     * @param entity
     */
     @Transactional
    public void deleteBatch(SyResearchReportFile entity) {
           this.syResearchReportFileDao.deleteByEntity(entity);
    }

	/**
     * 根据研报id和类型删除文件
    * @param syResearchReportFile
    * @return
    */
	@Transactional
   public  int deleteByResearchReportId(SyResearchReportFile syResearchReportFile){
   	 return syResearchReportFileDao.deleteByResearchReportId(syResearchReportFile);
    }
    
    /**
     * 根据研报id查询研报封面图
    * @return
    */
   public List<SyResearchReportFile> getResearchReportImage(Integer id){
   	return  syResearchReportFileDao.getResearchReportImage(id);
   }
    
   
}